package com.ebo.download.download2;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;

import utils.Lg;

import static com.ebo.agora.openvcall.AGApplication.InstallApkName;

/**
 * Created by admin on 2017/4/21.
 */

public class InitApkBroadCastReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {

        if (Intent.ACTION_PACKAGE_ADDED.equals(intent.getAction())) {
            Lg.d("监听到系统广播添加 intent=" + intent);
            {
                String packageName = intent.getDataString();
                Lg.d("安装了:" + packageName + "包名的程序");
            }
            Lg.d("InstallApkName = "+InstallApkName);
            if (!TextUtils.isEmpty(InstallApkName)) {
                DownloadListActivity.delTask(InstallApkName);
                InstallApkName = null;
            }
        }

        if (Intent.ACTION_PACKAGE_REMOVED.equals(intent.getAction())) {
            Lg.d("监听到系统广播移除");

        }

        if (Intent.ACTION_PACKAGE_REPLACED.equals(intent.getAction())) {
            Lg.d("监听到系统广播替换 intent=" + intent);

        }
    }

}